<!DOCTYPE html>
<html lang="en">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
      name="viewport">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="UTF-8">
<title>标签</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/dist/css/oa-app.css">
<head>
    <style>

    </style>
</head>
<body>
<div id="app">
    <div class="oa-tab-scroll">
        <div class="oa-slide ">
            <div v-if="roleName == '区域经理' ||roleName == '大区经理' || roleName == '区域组长' ||roleName == '大客户经理'" :class="selectIndex==0? 'tabActive':'tabNo'" @click="selectIndex=0;changeIf()">意向管理</div>
            <div  :class="selectIndex==1? 'tabActive':'tabNo'" @click="selectIndex=1;changeIf()">今日数据</div>
            <div :class="selectIndex==2?'tabActive':'tabNo'" @click="selectIndex=2;changeIf()">统计报表</div>
        </div>
    </div>
    <iframe id="gzbg" style="width: 100%;margin-top: 47px;height: 850px" src="" frameborder="0"></iframe>
</div>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="https://file.ggxqce.com/web/axios.min.js"></script>
<script src="/dist/js/newOaApp.js"></script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            userId: getUrlParamObj().userId,
            dateTime:new Date().Format("yyyy-mm-dd"),
            roleName: '',
            tabList: [],
            selectCompany: 0,
            selectIndex:0,
            userInfo:{}
        },
        methods: {
            //打开基本信息
            clickTab: function (pos) {
                var that = this;
                var obj = {
                    type: 'click',
                    position: pos
                }
                prompt(JSON.stringify(obj));
            }
            ,
            getDetail:function(){
                var that = this;
                if(that.roleName == "区域经理"||that.roleName == "大客户经理" ){
                    var ifrem = document.getElementById("gzbg");
                    ifrem.setAttribute('src',"/page/intentionManagement/quYuIntentionalListAppNew.html?userId="+that.userId);
                }
                else if(that.roleName == "大区经理"||that.roleName == "区域组长" ){
                    var ifrem = document.getElementById("gzbg");
                    ifrem.setAttribute('src',"/page/intentionManagement/daQuIntentionalListAppNew.html?userId="+that.userId);
                }
                /*else if(that.selectIndex=1) {
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/groupReportForm/groupReadApp.html?userId="+that.userId+"&companyId="+that.userInfo.companyId+"&dateTime="+that.dateTime+"&roleName="+that.userInfo.roleName+"&departId="+that.userInfo.departId);

                }*/
            },
            getUserInfo: function () {
                var that = this
                axios.post(urlConfig.system.user.getUserViewById,{"id": that.userId
                })
                    .then(function (data) {
                        console.log(data)
                        that.roleName = data.roleName
                        that.userInfo=data
                        if(that.roleName != '区域经理'&&that.roleName != '大区经理'&&that.roleName != '区域组长'&&that.roleName != '大客户经理'){
                            that.selectIndex=1
                        }
                        that.getDetail();
                    })
            },
            changeIf:function () {
                var that = this;
                if(that.selectIndex==0){
                    if(that.roleName == "区域经理"||that.roleName == "大客户经理" ){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/intentionManagement/quYuIntentionalListAppNew.html?userId="+that.userId);
                    }
                    else if(that.roleName == "大区经理"||that.roleName == "区域组长" ){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/intentionManagement/daQuIntentionalListAppNew.html?userId="+that.userId);
                    }
                }else if(that.selectIndex==1){
                    if(that.roleName == "区域经理"||that.roleName == "大客户经理" ){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/newReportForm/districtManagerReportForm/daQuIntentionalListNewApp.html?userId="+that.userId+"&dateTime="+that.dateTime);
                    }else if(that.roleName == "大区经理"||that.roleName == "区域组长"){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/newReportForm/daQuIntentionalNewApp.html?userId="+that.userId+"&dateTime="+that.dateTime);
                    }
                    /*else{
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/groupReportForm/groupReadApp.html?userId="+that.userId+"&companyId="+that.userInfo.companyId+"&dateTime="+that.dateTime+"&roleName="+that.userInfo.roleName+"&departId="+that.userInfo.departId);
                    }*/
                }else if(that.selectIndex==2){
                    if(that.roleName == "区域经理"||that.roleName == "大客户经理" ){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/newReportForm/quYuReportApp.html?userId="+that.userId+"&dateTime="+that.dateTime);
                    }else if(that.roleName == "大区经理"||that.roleName == "区域组长"){
                        var ifrem = document.getElementById("gzbg");
                        ifrem.setAttribute('src',"/page/reportForm/newReportForm/daQuReportApp.html?userId="+that.userId+"&dateTime="+that.dateTime);
                    }
                }
            }
        },
        mounted: function () {
            var that = this;
            that.getUserInfo()
            console.log(that.selectIndex)
        }
    })
</script>

</body>
</html>